All Questions
30 questions
0votes
2answers
745views
Microservices - create post for logged in user
I am working on a small project with microservices architecture in Spring Boot. As to not make unnecessary calls to users-microservice, I have duplicated some necessary User data (id, name, summary, ...
1vote
4answers
1kviews
Are static classes/methods good for pure business logic?
I have a service class that performs some operations. One of the operations is a piece of code long enough to warrant extracting to a new class and unit test it in isolation: @Service public class ...
2votes
3answers
354views
Exposing multiple classes from the representive package for one entity
I have a simple app for storing the movies, that exposes REST API. I am using spring-boot. I am using this simple app as an example, however, the question is more about general good practice. I am ...
0votes
1answer
450views
How to use single Spring-Boot instance to cater to multiple environments?
We have a Spring-Boot Web application currently deployed to 7 environments (DEV, SIT, UAT, Pre-Prod, Prod, etc.). This application connects to other REST services, which has different URLs for each of ...
-1votes
3answers
1kviews
Should methods with business logic be made private? [duplicate]
So I am writing a project using Spring Boot. All of my logic resides in @Service classes. I have separated each service class based on entity. For example - If I have two independent entities A and B, ...
0votes
1answer
192views
Structure and placement of a exporting module
Its an infrastructure monitoring application. We have a spring boot (2.x) based Service Oriented Architecture (SOA) with multiple modules in our project and the center point is a REST services module ...
1vote
1answer
804views
Spring Boot/Batch: Should every Job be separate Maven module?
I'm building a backend service powered by Spring Batch which enables to define and Jobs. Currently, I have several jobs, that essentially, aren't related one to another. So, I have one application....
2votes
1answer
893views
How to build a modular/extensible Spring Boot application?
I'm developing a Spring boot / Batch application. What I'd like to do is to have a separated module for every job. This is a reasonable decision because different tasks (Spring Batch Job) have ...
1vote
0answers
5kviews
Spring Data MongoDB: Update document based on multiple identifiers with Composite ID vs. MongoTemplate upsert vs. MongoRepository find & save
I'm wondering for best practices to upsert a document based on two identifiers. @Document(collection = "cars") public class CarEntity { @Id private ObjectId id; private String ...
3votes
2answers
2kviews
Where to save JWT token?
We(in my company) use to save the JWT token in the cookie. The web application is on Spring boot + JSP application. So the flow is, in a successful login service send a JWT token, that token has been ...
2votes
1answer
163views
Handling OAuth 2.0 access token
I am creating a rest template to consume REST API secured by OAuth 2.0. The provider has implemented an expiry for the access token for 5 mins. So Using the rest template, I will be calling the ...
-3votes
1answer
97views
Should vanilla solutions be avoided in Spring web applications?
I am making a Java and Spring webapp that scrapes data from a web and then publishes it through an API. Some of the raw scrapped data is in the form of Set<SomeObject> which I then convert to a ...
3votes
1answer
119views
How would I approach collecting statistic across a method call chain?
Let's say I have an processing pipeline. It receives a file, converts the file to data, interprets the data, and then persists it. At every step of this way, I would need to collect statistics, so I ...
2votes
4answers
188views
Make a class depends on its own ports instead of injecting dependency interfaces
I just have an idea about dependency management in Spring IOC environment that seems to be better than the typical approach, but I am not sure because I can't find any references or example out there ...
0votes
2answers
3kviews
Using Spring Boot's @ConfigurationProperties without violating Law of Demeter
My apps commonly have one or more prop holders. These holders contain config data used in the app such as: @Component @ConfigurationProperties(prefix="app.orders") @Data //lombok public class ...